// 页面路径：store/index.js 
import Vue from 'vue'
import Vuex from 'vuex'
import map from './module/map';
import maptool from './module/maptool';   
import user from './module/user';
import permission from './module/permission';
import common from './module/common';
Vue.use(Vuex);//vue的插件机制

//Vuex.Store 构造器选项
const store = new Vuex.Store({
    state: {//存放状态
      
    },
    getters:{
        // 登录状态
        isLogin: (state) => state.user.isLogin,
        // 用户姓名
        username: (state) => state.user.userInfoObj.username,
        // 用户ID
        userId: (state) => state.user.userInfoObj.userId,

        roles: state => state.user.roles,

        routes: state => state.permission.routes,

        userInfoObj: state => state.user.userInfoObj,
    },
    mutations: {
        //
    },
    actions: {
        //
    },
    modules: {
        user,
        map,
        maptool,
        permission,
        common
    }
})
export default store